<?php
// +-------------------------------------------------------------------
// |
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Service\Api\V1;

class LatereNewsList
{
    public $login = false; //是否需要登录才能访问该接口
    public $title = "最新政策列表(ok)";
    public $group = '首页';
    public $desc = "";

    public $input = [
    ];

    public $output = [
       'list' => [
           [
               'id' => 'label=id;',
               'title' => 'label=标题;',
               'logo_img' => 'label=logo图;',
               'new_desc' => 'label=描述;',
               'content' => 'label=内容;',
               'create_time' => 'label=创建时间;',
               'type' => 'label=类型： zw政务 yq园区;',
           ]
       ]
    ];

    public function run($param, $uid)
    {

        $list1 = M('news')->order('create_time desc')->limit(0,5)->select();
        foreach($list1 as &$item){
            $item['type'] = 'zw';
        }
        $list2 = M('yq_news')->order('create_time desc')->limit(0,5)->select();
        foreach($list2 as &$item){
            $item['type'] = 'yq';
        }
        $list = array_merge($list1, $list2);
        return ['list' => $list];
    }
}
